package com.analyse.stock.model;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.math.BigDecimal;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_stock_kline_monthly")
public class StockKlineMonthlyModel extends StockKlineModel<StockKlineMonthlyModel> {

    public static StockKlineMonthlyModel transStockKlineModel(String[] str,String stockCode){
        StockKlineMonthlyModel model = new StockKlineMonthlyModel();
        model.setStockCode(stockCode);
        model.setTradeDate(DateUtil.parse(str[0]));
        model.setOpenPrice(new BigDecimal(str[1]));
        model.setPrice(new BigDecimal(str[2]));
        model.setHighPrice(new BigDecimal(str[3]));
        model.setLowerPrice(new BigDecimal(str[4]));
        model.setTradeVolume(new BigDecimal(str[5]));
        model.setTradeAmount(new BigDecimal(str[6]));
        model.setAmplitude(new BigDecimal(str[7]));
        model.setUpDownPercent(new BigDecimal(str[8]));
        model.setUpDownAmt(new BigDecimal(str[9]));
        model.setExchangeRate(new BigDecimal(str[10]));
        return model;
    }
}
